<template>
  <div class="child1" @click="sendMsg">
    child1
  </div>
</template>

<script setup>
import { ref } from 'vue';
const emit=defineEmits(['send'])  //子传给父
const msg = ref('这是给组件2的数据')
const sendMsg = () => {
  //把msg给父组件
  emit('send',msg.value)
}


</script>

<style  scoped>
.child1 {
  width: 200px;
  height: 200px;
  background: yellow;
}
</style>